﻿using System.Collections.Generic;

public interface ITreeNode<T>
{
    T Parent { get; }
    int ChildCount { get; }

    T GetChild(int index);

}

public class ArrayTreeNodeProtected<T> : ITreeNode<T>
{
    public T Parent { get; protected set; }
    public int ChildCount { get { return childs.Length; } }

    public T GetChild(int index)
    {
        return childs[index];
    }

    protected T[] childs;
}

public class ListTreeNodepublic<T> : ITreeNode<T>
{
    public T Parent { get;  set; }
    public int ChildCount { get { return childs.Count; } }

    public T GetChild(int index)
    {
        return childs[index];
    }

    public List<T> childs;
}

